using CMS.Entity;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace CMS.EFCore.Config;

public class UserConfig : IEntityTypeConfiguration<User> {
    public void Configure(EntityTypeBuilder<User> builder) {
        builder.Property(a => a.UserName).HasMaxLength(20).IsRequired();
        builder.Property(a => a.UserPassword).HasMaxLength(20).IsRequired();
        builder.Property(a => a.UserEmail).HasMaxLength(100).IsRequired();
        builder.Property(a => a.UserPhone).HasMaxLength(16).IsRequired();
        builder.Property(a => a.Gender).HasDefaultValue(0);
        builder.Property(a => a.PhotoUrl).HasMaxLength(100).HasDefaultValue("images/default.jpg");
    }
}